<template>
  <div>{{ count }}</div>
  <div>obj数据： {{ obj.name }}, {{ obj.time }}</div>
</template>

<script setup>
import { ref, reactive, watch } from 'vue';

const count = ref(10);
const obj = reactive({ name: '要吃饭了', time: 12 });

watch([count, obj], ([newCount, newObj], [oldCount, oldObj]) => {
  console.log('新值：', newCount, newObj.name, newObj.time);
  console.log('旧值：', oldCount, oldObj.name, oldObj.time);
});

setTimeout(() => {
  count.value = 2000;
  obj.time++;
}, 3000);

// setTimeout(() => {
//   obj.name = '不要着急';
// }, 4000);
</script>
